package com.zhang.zxx.boot.controller.ruletest;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * RuleVO:规则匹配结果
 *
 * @author zhangxiaoxiang
 * @date 2022/02/24
 */
@Data
public class RuleVO {

    /**
     * 能否直接进入
     */
    private Boolean canDirectIn;
    /**
     * 不能直接进入的提示消息
     */
    private List<String> messageList;
    /**
     * 将要跳转的url[云课堂或者对应系统的url]
     */
    private String baseUrl;

    public RuleVO() {
    }

    public RuleVO(Boolean canDirectIn) {
        this.canDirectIn = canDirectIn;
    }

    public RuleVO(Boolean canDirectIn, List<String> messageList, String baseUrl) {
        this.canDirectIn = canDirectIn;
        this.messageList = messageList;
        this.baseUrl = baseUrl;
    }

    public RuleVO(List<String> messageList, String baseUrl) {
        this.messageList = messageList;
        this.baseUrl = baseUrl;
    }

    /**
     * 能够直接进入系统
     *
     * @return RuleVO
     */
    public static RuleVO canDirectInVO() {
        return new RuleVO(true);
    }

    /**
     * 不能直接进入
     *
     * @return RuleVO
     */
    public static RuleVO canNotDirectInVO(List<String> messageList, String baseUrl) {
        return new RuleVO(false, messageList, baseUrl);
    }

    public static void main(String[] args) {
        System.out.println(canDirectInVO());
        List<String> list=new ArrayList<>();
        list.add("1");
        list.add("good");
        RuleVO ruleVO = canNotDirectInVO(list, "http://www.baidu.com");
        System.out.println("ruleVO = " + ruleVO);

    }
}
